<?php
$this->headLink(array('href' => '/cms/styles/style.css', 'rel' => "stylesheet", 'type' => "text/css"));
$this->headLink(array('href' => '/cms/styles/data-table.css', 'rel' => "stylesheet", 'type' => "text/css"));

$this->headScript()
	->appendFile('/cms/scripts/dojo/dojo.js','',array('djConfig'=> 'parseOnLoad:true, isDebug:false'))
	->setAllowArbitraryAttributes(true);

$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/shadowbox/build/adapter/shadowbox-base.js');
$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/shadowbox/build/shadowbox.js');

$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/content.js');
$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/Popup.js');
$this->headScript(Zend_View_Helper_HeadScript::FILE,'/cms/scripts/TableData.js');
$this->headScript(Zend_View_Helper_HeadScript::SCRIPT,<<<EOD

dojo.require("dojo.fx");
dojo.require("dijit.Dialog");

var boxes = new Array();


Shadowbox.loadSkin('classic', '/cms/scripts/shadowbox/src/skin');
Shadowbox.loadLanguage('ru', '/cms/scripts/shadowbox/build/lang');
Shadowbox.loadPlayer(['html', 'iframe', 'img', 'swf'], '/cms/scripts/shadowbox/build/player');

var shadowbox_callback = function () {};

reset_shadowbox_callback = function () {
	shadowbox_callback = function () {};
} 

window.onload = function () {
	Shadowbox.init(
    	{
			modal:		true,
			onClose: function() { shadowbox_callback() }
		}
	);
}	
	
	
function doCollapse(el) {
	if (typeof boxes[el] == 'undefined'){
		boxes[el] = 0;
	}
	if (boxes[el]==1) {
		var currentAnimation = dojo.fx.wipeOut({node: el,duration: 300});
		boxes[el] = 0;
	} else {
		var currentAnimation = dojo.fx.wipeIn({node: el,duration: 300});
		boxes[el] = 1;
	}
    currentAnimation.play();
}

function showUser(user_id) {
                Shadowbox.open({
			      player:     'iframe',
			      title:      'Профиль пользователя',
			      content:    '/cms/users/view/user_id/'+user_id,
			      height:     450,
			      width:      750
			  });
			}
EOD
);

//$this->layout()->body_attr = 'class="modal"';
?>
<link href="cms/styles/data-table.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.messageBox {
	border: 1px dashed #CCCCCC;
	margin-bottom: 12px;
}
.messageBoxHeader {
	background-color: #EBEBEB;
	height: 26px;
}
.messageBoxCollapse {
	padding: 5px;
	float: left;
}
.messageBoxControlls {
	padding: 5px;
	float: right;
}
.messageBoxTitle {
	padding: 5px;
	float: left;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
}
.messageBoxBody {
	padding-top: 10px;
	padding-right: 5px;
	padding-bottom: 10px;
	padding-left: 31px;
	border-top-width: 1px;
	border-top-style: dashed;
	border-top-color: #CCCCCC;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 16px;
	text-align: justify;
}
.messageBoxBodyControls {
	margin-top: 20px;
}

.dijitDialog {
background:#EEEEEE none repeat scroll 0 0;
border:1px solid #D3D3D3;
padding:0;
}
.dijitDialogTitleBar {
	background-color: #CCCCCC;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	padding: 6px;
}
.dijitDialogPaneContent {
	padding: 6px;
}

.dijitDialog {
padding:1px;
position:absolute;
z-index:999;
}
.dijitContentPane {
display:block;
overflow:auto;
}
.dijitDialogCloseIcon {
background:transparent url(images/spriteRoundedIconsSmall.png) no-repeat scroll right top;
cursor:pointer;
float:right;
height:15px;
position:absolute;
right:6px;
top:4px;
vertical-align:middle;
width:15px;
}
-->

</style>
</head>

<body class="modal">
<p class="stnd_font">Показать:<a href="/cms/comments/index/comment_id/<?=$this->comment_id?>/checked/1">Непроверенных</a> <a href="/cms/comments/index/comment_id/<?=$this->comment_id?>/all/1">Всех</a></p>

<?php
    $cnt = $this->comments->length();
    for($i=0; $i<$cnt; $i++){
        $comm = $this->comments->item($i);?>
        
<div class="messageBox">
  <div class="messageBoxHeader">
    <div class="messageBoxControlls">
        <!--a href="#"><img src="/cms/images/document_pencil.png" width="16" height="16" /></a--> 
	<?php if( $comm->checked_f == 0 ) { ?>
       <a href="/cms/comments/check/id/<?=$comm->id?>"><img src="/cms/images/exclamation_frame.png" width="16" height="16" /></a>        
<?php } ?>
        <a href="#"><img src="/cms/images/document_pencil.png" width="16" height="16" onclick="dijit.byId('edit_<?=$comm->id?>').show()"/></a>         
        <a href="/cms/comments/delete/id/<?=$comm->id?>"><img src="/cms/images/cross.png" width="16" height="16" /></a></div>

    <div class="messageBoxCollapse"><a href="javascript:;" onclick="doCollapse('msg_<?=$comm->id?>')">
    <img src="/cms/images/plus_circle.png" alt="" width="16" height="16" /></a></div>
    <div class="messageBoxTitle">
        <?=$comm->add_date?> <a href="#" onclick="showUser(<?=$comm->user->user_id?>);"><?=$comm->user->name_f?> <?=$comm->user->name_i?> <?=$comm->user->name_o?> (<?=$comm->user->login?>)</a>
    </div>
  </div>
  <div class="messageBoxBody" id="msg_<?=$comm->id?>" style="display:none"><?=nl2br($comm->message)?>

  <div class="messageBoxBodyControls"><a href="#">
        <img src="/cms/images/document_pencil.png" width="16" height="16" align="absbottom" /></a> 
        <a href="javascript:;" onclick="dijit.byId('edit_<?=$comm->id?>').show()">Редактировать</a> &nbsp;&nbsp; 
        <a href="#"><img src="/cms/images/cross.png" width="16" height="16" align="absmiddle" /></a> 
        <a href="/cms/comments/delete/id/<?=$comm->id?>">Удалить</a> &nbsp;&nbsp;
	<?php if( $comm->checked_f == 0 ) { ?>
        <a href="#"><img src="/cms/images/exclamation_frame.png" width="16" height="16" align="absmiddle" /></a> 
        <a href="/cms/comments/check/id/<?=$comm->id?>">Проверить</a>
	<?php } ?>
    </div>

    <div dojoType="dijit.Dialog" id="edit_<?=$comm->id?>" title="Редактирование сообщения" execute="alert('submitted w/args:\n' + dojo.toJson(arguments[0], true));">
      <form id="form1" name="form1" method="post" action="/cms/comments/edit">
        <input type='hidden' name='id' value='<?=$comm->id?>'>
        <textarea name="message" cols="40" rows="8" class="modalInput" id="textfield"><?=$comm->message?></textarea>
        <div style="margin-top: 10px">
          <input type="submit" class="okButton" value="Сохранить" />
          <input type="button" class="okButton" value="Закрыть" />
        </div>
      </form>
    </div>
  </div>
</div>        
<?php    
    } //конец цикла вывода комментариев
?>

</body>

</html>
